const express = require("express")
const router = express.Router()

const exec = require('child_process').execSync

router.post('/push', function (req, res) {
  if (req.headers['x-gitee-token'] === 'Fliuzhixia37chi!') {
    exec('bash ./scripts/deploy.sh')
  } else {
    res.json({
      code: 1000001,
      message: 'web hook password incorrect' 
    })
  }  
})

module.exports = router; // 导出路由
